User defined function to create multi-level drop-down